<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- <link rel="stylesheet" href="1.css"> -->
  <style>
    /* .child {
      width: 0;
      height: 0;
      border-top: 100px solid cyan;
      border-left: 50px solid transparent;
      border-right: 50px solid transparent;
    } */
    #demo {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      width: 500px;
      height: 100px;
      margin: auto;
      /* 或者 margin: 0 auto; */
    }
  </style>
</head>

<body>
  <!-- <div class="box" id="box">
    水平居中的盒子
  </div> -->
  <!-- 
  <script>
    let HTML = document.documentElement
    winW = HTML.clientWidth
    winH = HTML.clientHeight
    boxW = box.offsetWidth
    boxH = box.offsetHeight
    document.body.style.position = 'relative'
    box.style.position = 'absolute'
    box.style.left = (winW - boxW) / 2 + 'px'
    box.style.top = (winH - boxH) / 2 + 'px'
  </script> -->

  <!-- <div class="child"></div> -->
  <div id="demo">
    <div>1111s</div>
  </div>
</body>

</html>